package com.ssy.lingxi.product.repository.warehouse;

import com.ssy.lingxi.product.entity.warehouse.Invoices;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Set;

@Repository
public interface InvoicesRepository extends JpaRepository<Invoices, Long> , JpaSpecificationExecutor<Invoices> {

    /**
    * 根据单据类型ID查询单据信息
    * @author wrc
    * @date 2020/7/9
    */
    List<Invoices> findAllByInvoicesTypeIdEquals(Long invoicesTypeId);

    Invoices findByInvoicesNo(String invoicesNo);

    Boolean existsAllByInvoicesTypeId(Long invoicesTypeId);

    @Transactional
    void deleteAllByIdIn(Set<Long> ids);
}
